<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /*css初始化*/
body,div,hr{
    /*magin外边距 上右下左都是0px*/
    margin: 0px;
    /*内边距*/
    padding: 0px;
}
        div{
            width: 200px;
            height: 200px;
            border: 1px solid blue;
            line-height:200px;
text-align: center;
vertical-align: middle;
        }
        #d1{
            /*单个设置边距*/
            margin-top:40px ;
            margin-right: 40px;
            margin-bottom:40px ;
            margin-left: 40px;
        }
        #d2{
            margin: 40px 40px 40px 40px;
        }
        #d3{
            /*magin 上下 左右*/
            margin: 20px 40px;
        }
        #d4{
            
            /*margin 上 左右 下*/
            margin: 10px 20px 40px;
        }
    </style>
</head>
<body>
    <div id="d1">div盒子1</div>
    <hr>
       <div id="d2">div盒子2</div>
       <hr>
          <div id="d3">div盒子3</div>
          <hr>
             <div id="d4">div盒子4</div>
             <hr>
</body>
</html>